//
//  LoginEndpoint.swift
//  CleanArchitecture
//
//  Created by siri on 2024/11/7.
//  Copyright © 2024 Tuan Truong. All rights reserved.
//



import APIService
import Foundation

enum LoginEndpoint {
    case login(username: String, password: String)

}

extension LoginEndpoint: Endpoint {
    // 接口基础路径
    var base: String? {
        "http://10.10.0.228:8799"
    }
    
    // 接口请求路径
    var path: String? {
        switch self {
        case .login:
            return "/RYGL/getLoginInfo"
        }
    }
    
    var urlString: String? {
        switch self {
        default:
            return nil
        }
    }
    
    // 请求方式
    var httpMethod:HttpMethod{
        switch self {
        case .login:
            return HttpMethod.post
        }
    }
    
    // 头部携带的信息
    var headers: [String: Any]? {
        switch self {
        case .login:
            return ["Content-Type":"application/json"]
        }
    }
    
    // 请求体
    var body: [String: Any]? {
        switch self {
        case let .login(username, password):
            // 请求参数
            return [
                "getLogInVO":[
                    "userNo" : username,
                    "userPassword" : password
                ]
            ]
            
        }
    }
}
